Skip to content

Merge main into feat/hailo-patchcore-e2e - #167

Closed
DeepKnowledge1 wants to merge 48 commits into
feat/hailo-patchcore-e2efrom
main
Closed

Merge main into feat/hailo-patchcore-e2e#167
DeepKnowledge1 wants to merge 48 commits into
feat/hailo-patchcore-e2efrom
main

Conversation

@DeepKnowledge1

Copy link
Copy Markdown
Owner

Sync the Hailo PatchCore E2E branch with the latest main. Keep the existing Hailo-specific changes and avoid unrelated modifications.

DeepKnowledge1 and others added 30 commits August 27, 2026 11:52
DeepKnowledge1 and others added 18 commits August 27, 2026 20:58
…, localization, Autopilot support, and testing fixes (#166)

## 🔗 Related Issue

Fixes #

## 📝 Description

This PR adds **EfficientAD support to AnomaVision** and integrates it
into the existing anomaly-detection pipeline alongside PaDiM and
PatchCore.

### 🚀 EfficientAD

* Added EfficientAD as a supported anomaly-detection algorithm.
* Integrated EfficientAD with the existing algorithm abstraction used by
PaDiM/PatchCore.
* Reused the existing AnomaVision data loading and preprocessing
pipeline.
* Added batched training/inference to avoid unnecessary repeated
computation.
* Optimized teacher feature extraction and removed unnecessary
inference-time computation.
* Added calibrated anomaly thresholds based on **normal training images
only**.
* Added anomaly-map generation for pixel-level localization.
* Reused the existing post-processing and visualization pipeline for:

  * anomaly heatmaps
  * localization masks
  * contours
  * bounding boxes
  * overlay visualizations

### 🔌 Deployment & Export

* Added EfficientAD support to the existing model/export workflow.
* Maintained compatibility with the existing ONNX-based detection flow.
* Preserved the existing PaDiM/PatchCore inference architecture rather
than introducing a separate EfficientAD pipeline.
* Added EfficientAD support to **Production Autopilot**.
* Autopilot can compare PaDiM, PatchCore, and EfficientAD candidates.
* EfficientAD calibration data is preserved with the model artifact.

### 📊 Production Autopilot

* Restored and preserved the rich `production_autopilot_report.html`
dashboard.
* Added EfficientAD to candidate comparison and model selection.
* Report includes:

  * Image AUROC
  * Pixel AUROC
  * median latency
  * P95 latency
  * anomaly coverage
  * normal false-positive localization rate
  * threshold
  * selected model
  * deployment artifact
  * localization health
  * reproducibility information
* Restored the existing timing/performance summary in the detection
pipeline.

### 🐛 Fixes

* Fixed EfficientAD training failure caused by PyTorch inference-mode
tensors being used in autograd.
* Fixed JSON serialization of NumPy/PyTorch scalar metrics in the
Autopilot deployment manifest.
* Restored Autopilot report/test compatibility.
* Preserved existing helper APIs such as `_format_metric`.
* Fixed report metric naming/capitalization expected by the test suite.

## 🔄 Type of Change

* [x] 🐛 Bug fix (non-breaking change which fixes an issue)
* [x] 🚀 New feature (non-breaking change which adds functionality)
* [ ] 💥 Breaking change (fix or feature that would cause existing
functionality to not work as expected)
* [ ] 📖 Documentation update
* [ ] 🏗️ Infrastructure / CI/CD update

## 🧪 Hardware & Matrix Testing

**I have successfully built and tested this code using `uv` on:**

* [x] `anomavision[cpu]` (Standard/Edge)
* [ ] `anomavision[cu121]` (CUDA 12.1)
* [ ] `anomavision[cu124]` (CUDA 12.4)
* [ ] `anomavision[cu118]` (CUDA 11.8)

**Host OS used for testing:**

* [ ] Linux / Ubuntu
* [x] Windows (Native or WSL2)
* [ ] macOS

## 🧪 Validation

* [x] Existing Autopilot unit tests updated/fixed.
* [x] EfficientAD-specific integration changes covered.
* [x] Autopilot report generation validated.
* [x] Deployment manifest generation validated.
* [ ] Full `uv run pytest` suite verified on all supported environments.
* [ ] Bottle dataset benchmark completed for PaDiM vs PatchCore vs
EfficientAD.
* [ ] Full ONNX/OpenVINO/TensorRT/Hailo hardware validation completed.

## ✅ Developer Checklist

* [x] My code follows the core style guidelines of this project
(Ruff/Black formatting).
* [ ] I have run `uv run pytest` and all unit tests pass locally.
* [ ] **Lockfile Guard:** If I added or modified a dependency in
`pyproject.toml`, I have run `uv lock --python 3.10` and committed the
updated `uv.lock` file.
* [x] I have added tests that prove my fix is effective or that my
feature works.
* [x] I have updated the documentation accordingly (if applicable).

## 📸 Screenshots / Visual Proof

The Production Autopilot report now provides a rich HTML dashboard
comparing PaDiM, PatchCore, and EfficientAD, including localization and
deployment metrics.

Recommended screenshots:

* `production_autopilot_report.html`
* EfficientAD anomaly heatmap
* EfficientAD localization mask/overlay
* PaDiM vs PatchCore vs EfficientAD comparison
* Autopilot model-selection summary
@DeepKnowledge1
DeepKnowledge1 deleted the main branch August 29, 2026 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant